// 泛型：定义的时候不确定，使用的时候可以传递过来这个类型

/* type TRes1 = {
  code: number;
  message: string;
  data: {
    name: string;
    age: number;
  }[];
}

type TRes2 = {
  code: number;
  message: string;
  data: {
    title: string;
    content: string;
  }[];
} */

type TRes<T> = {
  code: number;
  message: string;
  data: T[]
}

// 后端返回的用户列表
const res1: TRes<{ name: string; age: number }> = {
  code: 0,
  message: '成功',
  data: [{
    name: 'zs',
    age: 18
  }, {
    name: 'ls',
    age: 19
  }]
}

// 后端返回的文章列表
const res2: TRes<{ title: string; content: string }> = {
  code: 0,
  message: '成功',
  data: [{
    title: '粗大事了',
    content: '86 期快毕业了'
  }, {
    title: '震惊',
    content: '平均工资破万'
  }]
}

export { }